package com.bckj.fastboot.iot.biz.controller;

import com.bckj.fastboot.core.lang.model.PageResult;
import com.bckj.fastboot.core.page.PageSupport;
import com.bckj.fastboot.iot.api.service.IotDeviceDataRemoteService;
import com.bckj.fastboot.iot.biz.service.IotDeviceDataQueryService;
import com.bckj.fastboot.iot.common.dto.query.IotDeviceDataQuery;
import com.bckj.fastboot.iot.common.dto.response.IotDeviceDataResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * IotDeviceDataController
 *
 * @author wfc
 **/
@RestController
@RequiredArgsConstructor
@RequestMapping("iotDeviceData")
public class IotDeviceDataController implements IotDeviceDataRemoteService {

    private final IotDeviceDataQueryService iotDeviceDataQueryService;

    @Override
    public PageResult<IotDeviceDataResponse> page(IotDeviceDataQuery query) {
        return iotDeviceDataQueryService.page(PageSupport.buildPage(), query);
    }

    @Override
    public IotDeviceDataResponse realData(IotDeviceDataQuery query) {
        return iotDeviceDataQueryService.realData(query);
    }

    @Override
    public PageResult<IotDeviceDataResponse> historyData(IotDeviceDataQuery query) {
        return iotDeviceDataQueryService.historyData(PageSupport.buildPageable(), query);
    }

    @Override
    public IotDeviceDataResponse lineData(IotDeviceDataQuery query) {
        return iotDeviceDataQueryService.lineData(query);
    }

}
